package com.qf.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.entity.EprOrders;
import com.qf.service.ReturnListService;
import com.qf.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * --- 机魂大悦 ---
 *
 * @author L
 * @date 2024/7/27
 * @desc
 */
@RestController
@RequestMapping("sell/returnGetList")
public class returnList {
    @Autowired
    private ReturnListService service;
        @GetMapping("/list")
        public R findAll(@RequestParam HashMap<String, String> map) {
            // 分页
            int pageNum = Integer.parseInt(map.get("pageNum"));
            int pageSize = Integer.parseInt(map.get("pageSize"));
            PageHelper.startPage(pageNum, pageSize);

            List<EprOrders> list = service.findAll(map);
            PageInfo<EprOrders> info = new PageInfo<>(list);

            return R.ok(info);
        }
    @PostMapping("/returnUpMeasure")
    public R returnUpMeasure(@RequestBody HashMap<String, String> map) {

        boolean upDataOk = service.returnUpMeasure(map);
        return R.ok(upDataOk);
    }
    @PostMapping("/returnAddFind")
    public R returnAddFind(@RequestBody HashMap<String, String> map) {

        boolean addOk = service.returnAddFind(map);
        return R.ok(addOk);
    }
    @GetMapping("/returnListDelMore")
    public R returnListDelMore(@RequestParam List<Integer> ids) {

        boolean delOk = service.returnListDelMore(ids);
        return R.ok(delOk);
    }
    @GetMapping("/returnDelById")
    public R returnDelById(int  id) {
        boolean orderDelMore = service.returnDelById(id);
        return R.ok(orderDelMore);
    }
}
